//
//  MessageTableViewCell.m
//  明和智能
//
//  Created by 李李善 on 2018/8/24.
//  Copyright © 2018年 inno. All rights reserved.
//

#import "MessageTableViewCell.h"

@implementation MessageTableViewCell

-(void)onAsInitAddView:(UIView *)view forViewController:(UIViewController *)ViewController forDataSource:(id)dataSource AtIndexPath:(NSIndexPath *)indexPath
{
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    self.backgroundColor = [UIColor clearColor];
    UIView *bjView = ({
        UIView *l  = [UIView new];
        l.backgroundColor = [UIColor whiteColor]
        ;
        [view addV:l];
        l;
    });
    UILabel *title = ({
        UILabel *l  = [UILabel new];
        l.text = @"您的优惠卷2天后过期";
        l.font = kSysFont(kFitW(13));
        [bjView addV:l];
        l;
    });
    
    UIView *dian = ({
        UIView *l  = [UIView new];
        l.backgroundColor = hexCOLOR(@"FD8F25");
        l.cornerRadius = kFitW(10)/2;
        [l masksToBounds];
        [bjView addV:l];
        l;
    });
    
    UILabel *timer = ({
        UILabel *l  = [UILabel new];
        l.text = @"18/02/01";
        l.textColor = hexCOLOR(@"747473");
        l.font = kSysFont(kFitW(12));
        [bjView addV:l];
        l;
    });
    
    UILabel *title1 = ({
        UILabel *l  = [UILabel new];
        l.text = @"asdoisaodjaskdjkasdkaskdjalksjdkljaskldjklasjdklasjkldjaklsjdajsdl";
        l.font = kSysFont(kFitW(11));
        l.numberOfLines= 0;
        l.textColor = hexCOLOR(@"747473");
        [bjView addV:l];
        l;
    });
    
    UIImageView *imageV = ({
        UIImageView *l  = [UIImageView new];
        l.image = [UIImage imageNamed:@"xiaoxi_icon"];
        [bjView addV:l];
        l;
    });
    
    
    [self onMainSetSubViewFrame:^(UIView *view, CGPoint origin, CGSize size, CGPoint center) {
        bjView.frame=  CGRectMake(kFitW(15),kFitH(15),size.width-kFitW(30),size.height-kFitH(15));
        
        
        [title sizeToFit];
        title.left = kFitW(25);
        title.top = kFitH(15);
        
        dian.size = CGSizeMake(kFitW(10), kFitW(10));
        dian.left = kFitW(4);
        dian.centerY= title.centerY;
        
        
        
        [timer sizeToFit];
        timer.right = bjView.width-kFitW(15);
        timer.centerY = title.centerY;
        
        imageV.size = CGSizeMake(kFitW(60), kFitW(60));
        imageV.right = bjView.width-kFitW(15);
        imageV.bottom =bjView.bottom-kFitH(25);
        
        title1.width =imageV.left-kFitW(35);
        [title1 sizeToFit];
        title1.left =title.left;
        title1.top =title.bottom+kFitH(15);
        
        
    }];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
